﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WindowsPhoneEssentials.Storage;
using WindowsPhoneEssentials.Testing;
using WindowsPhoneEssentials.Testing.Abstractions;
using WindowsPhoneEssentials.Testing.Threading;
using WindowsPhoneMVC.ActionResults;
using WindowsPhoneMVC.Framework;
using WindowsPhoneMVC.Tests.Navigation.Fakes;
using WindowsPhoneMVC.Tests.Phone.Fakes;

namespace WindowsPhoneMVC.Tests.Navigation
{
    [TestClass]
    public class NavigationApplicationTests
    {
        private PhoenixApplicationService phoenixApplicationServiceUnderTest;
        private FakePhoneApplicationFrame testPhoneApplicationFrame;
        private FakeMvcFrame fakeFrame;
        private FakePhoneApplicationService testPhoneApplicationService;
        private TransientStore applicationTransientStore;
        private FakeControllerLocator fakeControllerLocator;

        [TestInitialize]
        public void Setup()
        {
            fakeFrame = new FakeMvcFrame();
            testPhoneApplicationFrame = new FakePhoneApplicationFrame();
            testPhoneApplicationService = new FakePhoneApplicationService();
            applicationTransientStore = new TransientStore(new MemoryIsolatedStorateFileFactory(), new FakePhoneApplicationService());
            fakeControllerLocator = new FakeControllerLocator();
            fakeControllerLocator.Register<HomeController>();
            phoenixApplicationServiceUnderTest = new PhoenixApplicationService(
                testPhoneApplicationFrame,
                applicationTransientStore,
                fakeControllerLocator,
                new FakeControllerFactory(),
                new FakeViewLocator(),
                new TestTaskManager(),
                new TestBackgroundWorker(),
                new DefaultActionResolver(),
                testPhoneApplicationService);
            phoenixApplicationServiceUnderTest.StartService(null);
        }

        public class HomeController : Controller
        {
            public ActionResult Main()
            {
                return Nothing();
            }
        }
    }
}
